<script>
import { template } from '@/mixins/system'
export default {
  name: 'DbTemplateSetting',
  mixins: [template]
}
</script>
<style scoped>
.custom-tips {
  width: 100%;
  min-height: 40px;
  line-height: 40px;
  text-align: left;
  padding: 8px 16px;
  background-color: #ecf8ff;
  border-radius: 4px;
  border-left: 5px solid #50bfff;
}
.button-add {
  width: 50px;
  height: 40px;
  float: right;
  text-align: center;
  line-height: 40px;
  margin-right: 20px;
}
</style>
<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="close"
    :visible.sync="show"
    title="企业微信消息设置"
    width="700px"
  >
    <div v-loading="loading" class="custom-dialog-body">
      <el-form
        v-if="loading === false"
        ref="form"
        :inline="true"
        :model="set"
        size="small"
        label-width="120px"
      >
        <div class="custom-tips">
          参数设置
        </div>
        <el-row v-for="(item,index) in set.params" :key="'data-item-'+index" :gutter="20" style="margin-top: 10px">
          <el-col :span="24">
            <el-form-item
              label="参数名称"
              :prop="'params.'+index+'.key'"
              :rules="[{ required: true, message: '请输入参数名称', trigger: 'blur' }]"
            >
              <el-input v-model="item.key" readonly style="width: 400px" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="关联字段"
              :prop="'params.'+index+'.column'"
              :rules="[{ required: true, message: '请选择关联字段', trigger: 'change' }]"
            >
              <el-select v-model="item.column" clearable placeholder="请选择关联字段" style="width: 400px">
                <el-option
                  v-for="obj in column"
                  :key="obj"
                  :label="obj"
                  :value="obj"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="close">取消</el-button>
      <el-button
        :loading="saveObj"
        type="primary"
        @click="submitCU"
      >保存</el-button>
    </div>
  </el-dialog>
</template>
